package exam;


import java.util.Scanner;

public class jd {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int res = 0;
        if(k>=n){
            System.out.println(1);
            return;
        }
        for (int i = 0; i <= n / k; i++) {
            int temp = n - k * i + 1;
            if (temp >= i) res += Math.pow(temp, i) % 998244353;
            else res += Math.pow(i, temp) % 998244353;
        }
        System.out.println(res);

//        Scanner in = new Scanner(System.in);
//        int n = in.nextInt();
//        int[][] nums= new int[2][n];
//        for(int i=0;i<n;i++){
//            nums[0][i] = in.nextInt();
//        }
//        for(int i=0;i<n;i++){
//            nums[1][i] = in.nextInt();
//        }
//    }
    }
}
